#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int ret = 0;
        int n = nums.size();
        for (int idx = 0; idx <= n; idx++) {
            ret ^= idx;
        }

        for (int idx = 0; idx < n; idx++) {
            ret ^= nums[idx];
        }
        return ret;
    }
};

int main()
{
    Solution s;
    vector<int> vt{0,1,2,3,5,6};
    cout << s.missingNumber(vt) << endl;
    return 0;
}